
#pragma once

#include "../MT/array.h"
#include "../MT/util.h"
#include "../MT/ors.h"
#include "../MT/opengl.h"

/** 
Implements simple world editing functoinality (moving objects).
*/

class WorldEditor : public OpenGL::MouseEventListener
{
private:
	dxBody* mDraggingBody;

	ors::Camera *mCamera;
	MT::Array<dxBody*> *mBodies;

	void alignBodyOnGeometry(dxBody *body, int x, int y);

public:
	WorldEditor(MT::Array<dxBody*> *bodies, ors::Camera *camera) : mCamera(camera), mBodies(bodies), mDraggingBody(nullptr) {}

	void onMouseUp(int x, int y);
	void onMouseDown(int x, int y);
	void onMouseMove(int x, int y);

	dxBody* getSelectedBody(int x, int y);
};